package com.zaofan.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zaofan.bean.UserImage;
import com.zaofan.dao.UserImageDao;

public class UserImageService {
	private UserImageDao userImageDao = new UserImageDao();

	public void delete(UserImage userImage) {
		userImageDao.del(userImage);
	}

	public void add(UserImage userImage) {
		userImageDao.add(userImage);
	}

	public void update(UserImage userImage) {
		userImageDao.update(userImage);
	}

	public List<UserImage> findAll(Map<String, Object> params) {
		List<UserImage> data = userImageDao.findAll(params);
		if (data == null) {
			data = new ArrayList<>();
		}
		return data;
	}

	public Long count(Map<String, Object> params) {
		return userImageDao.count(params);
	}

	public UserImage findById(Integer id) {
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		return userImageDao.findOne(params);
	}

	public List<UserImage> findByUserId(String begin, String end, Integer userId) {
		return userImageDao.findByUserId(begin, end, userId);
	}

}
